<!DOCTYPE html>
<html lang=zh-CN>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport"
			content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1">
		<style type="text/css">

		</style>

		<script type="text/javascript" charset="utf-8"
			src="https://g.alicdn.com/jssdk/verify-h5-ui/0.0.3/uverify.min.js"></script>
		</script>
	</head>
	<body>
		<script type="text/javascript">
			// 授权页配置项 
			const authPageOption = {
				navText: "本机号码登录",
				btnText: "立即登录",
				vendorPrivacyPrefix: "《",
				vendorPrivacySuffix: "》",
				agreeSymbol: "、",
				privacyBefore: "请阅读并同意",
				privacyEnd: "",
				isFocus: true,
				isDialog: true,
				manualClose: true,
				privacyAlertIsNeedShow: true,
				showCustomView: true,
				customView: {
					element: '<div class="btn_box other" onclick="clickEvent()">关闭授权页</div>',
					style: ".btn_box.other{width: 10rem; line-height: 3rem; background: #3b82fe; color: #FFF;font-size: 1rem;border-radius: 5px;text-align: center;margin: 0 auto;}",
					js: "function clickEvent(){ window.uVerify.closePage(); }",
				},
			};

			// 按需调用h5一键登录功能 
			window.uVerify({
				data: {
					key: "cHVRAQMGUlMBWAMEWF0IW0c", // 你的秘钥
					appkey: "67a073dd9a16fe6dcd3c439a", // 你的appkey
				},
				authPageOption: authPageOption,
				callback: (res) => {

					alert(res.code)
					if (res.code === 600000) {
						alert(res.spToken)
						console.log('返回code=600000即表示成功', res);
						// 得到res.spToken即表示成功，使用spToken调用服务端接口换取明文手机号。
						// window.uVerify.closePage();  // 手动关闭授权页，按需调用 
						// const ukid = window.uVerify.getVerifyId();
					} else {
						//跳转到原来的登录页
						window.close();
						window.parent.postMessage({
							cmd: 'myIframe',
							params: {
								info: 'iframe向Vue传递的消息',
							}
						}, '*');
					}
				}
			});
		</script>

	</body>
</html>